// src/api/interface/permission.ts

/**
 * 权限管理相关类型定义
 */

export namespace Permission {
  // 基础权限信息
  export interface PermissionInfo {
    FId: string;
    FName: string;
    FCode: string;
    FDescription: string;
  }

  // 角色基础信息
  export interface RoleInfo {
    FId: string;
    FName: string;
    FCode: string;
    FDescription: string;
    FCreatedAt?: string; // 可选，创建时间
    FUpdatedAt?: string; // 可选，更新时间
  }
  export interface UserRole {
    FId: string;
    FName: string;
    FCode: string;
    FHasRole: boolean;
  }

  // 角色详细信息
  export interface RoleDetail extends RoleInfo {
    permissions: PermissionInfo[];
  }

  // 创建角色参数
  export interface CreateRoleParams {
    FName: string;
    FCode: string;
    FDescription?: string;
  }

  // 更新角色参数
  export interface UpdateRoleParams {
    FName?: string;
    FCode?: string;
    FDescription?: string;
  }

  // 创建权限参数
  export interface CreatePermissionParams {
    FName: string;
    FCode: string;
    FDescription?: string;
  }

  // 更新权限参数
  export interface UpdatePermissionParams {
    FName?: string;
    FCode?: string;
    FDescription?: string;
  }

  // 更新角色权限参数
  export interface UpdateRolePermissionsParams {
    FRoleId: string;
    FPermissionIds: string[];
  }

  // 更新用户角色参数
  export interface UpdateUserRolesParams {
    FUserId: string;
    FRoleIds: string[];
  }

  // 获取角色权限
  export interface RolePermissions {
    FId: string;
    FName: string;
    FCode: string;
    FHasPermission: Boolean;
    FModuleName: string;
    FModuleId: string;
  }
  export interface PermissionModule {
    id: string;
    FName: string;
    FCode: string;
    FDescription?: string;
    FOrderNum: number;
    FCreatedAt?: string;
    FUpdatedAt?: string;
  }

  // 创建权限模块参数
  export interface CreatePermissionModuleParams {
    FName: string;
    FCode: string;
    FDescription?: string;
    FOrderNum?: number;
  }

  // 更新权限模块参数
  export interface UpdatePermissionModuleParams {
    FName?: string;
    FCode?: string;
    FDescription?: string;
    FOrderNum?: number;
  }
}
